home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / RAND / ALL95.LZH / transcript_1003 / text0014.txt < prev    next >
Encoding:
Text File  |  1995-10-04  |  11.0 KB  |  279 lines

  1. This is not for now, but as I've found it, I give it before I forget.
  2. It is a HTML page, to view with mosaic or netscape, or cello, as you wish
  3.  
  4. <!DOCTYPE HTML SYSTEM "html.dtd">
  5. <HTML><HEAD><TITLE>The unofficial LMP format description</TITLE></HEAD>
  6. <BODY><H1>The unofficial LMP format description<BR>Public Version
  7. 1.10 (internal revision 20) - 24.10.1994</H1>
  8. <P><B>Written by:Uwe Girlich (girlich@aix520.informatik.uni-leipzig.de
  9. )</B></P>
  10. <H2>1. Introduction</H2>
  11. <P>A DOOM lmp file records all player actions. The monster movements,
  12. respawn   positions etc. are totally deterministic. The messages during
  13. a multiplayer game (chat mode) do not appear in the lmp.
  14. </P>
  15. <P>A lmp file consists of a header, a data area and a quit byte.</P>
  16. <UL>
  17. <LI>The header contains the skill, episode, start map, number of
  18. players etc.</LI>
  19. <LI>The data area is divided in game tics. For each player there are
  20. four    movement bytes per game tic.</LI>
  21. <LI>Each lmp should end with a quit byte (80h).</LI>
  22. </UL>
  23. <P>The duration of a gametic is round 1/35s. With time measurements
  24. with 4dos:</P>
  25. <PRE>timer ^ doom -playdemo name ^ timer</PRE>
  26. <P>of many differnet lmp's and linear curve fitting I found a slightly
  27. differnet frequency: 35.003Hz. So it is not wrong to speak of 35Hz but
  28. it is not totally correct. 
  29. </P>
  30. <H2>2. HEADER</H2>
  31. <P>Many thanks to Steffen Winterfeldt
  32. (wfeldt@tph100.physik.uni-leipzig.de) for his reverse engineering work.</P>
  33. <P>The easiest way to check the length of the header is to start DOOM
  34. with the record option. Then you have to press 'q' during the startup
  35. sequence.  In the moment, when the screen switchs from text mode to
  36. graphics mode, the game stops and you receive the shortest lmp file. It
  37. consists only of  the header and the quit game byte.</P>
  38. <P>The lmp header format is a subject of change.  Until DOOM 1.2 was
  39. the format of the 7 byte header:</P>
  40. <PRE>Byte  Type Contents
  41. 0000h Byte skill   (0-4)
  42. 0001h Byte episode (1-3)
  43. 0002h Byte map     (1-9)
  44. 0003h Byte 0/1     (green player)  \  
  45. 0004h Byte 0/1     (indigo player)  \ 0: this player doesnt play 
  46. 0005h Byte 0/1     (brown player)   / 1: this player plays
  47. 0006h Byte 0/1     (red player)    /
  48. The number of bytes (3-6) unequal to zero is the number of players.
  49. </PRE>
  50. <P>From Version 1.4 on the header consists of 13 bytes:</P>
  51. <PRE>Byte  Type Contents
  52. 0000h Byte version (104d=68h DOOM 1.4, 105d=69h DOOM 1.5, 106d=6Ah DOOM 1.6)
  53. 0001h Byte skill   (0-4)
  54. 0002h Byte episode (1-3)
  55. 0003h Byte map     (1-9)
  56. 0004h Byte multiplayer rule (0: Cooperative, 1: DeathMatch, 2: AltDeath)
  57. 0005h Byte respawn    0: off, !=0: on \  a value != 0 is the number of
  58. 0006h Byte fast       0: off, !=0: on  > this command line parameter
  59. 0007h Byte nomonsters 0: off, !=0: on /  (with expanded @paramfile)
  60. 0008h Byte the lmp is recorded from this player's view (0-3)
  61. 0009h Byte 0/1     (green player)  \  
  62. 000Ah Byte 0/1     (indigo player)  \ 0: this player doesnt play 
  63. 000Bh Byte 0/1     (brown player)   / 1: this player plays
  64. 000Ch Byte 0/1     (red player)    /
  65. The number of bytes (9-C) unequal to zero is the number of players.
  66.  
  67. </PRE>
  68. <P>Now it is very easy to change a existing lmp from one format to the
  69. other. The movement algorithm didn't changed from DOOM 1.2 to DOOM 1.5
  70. beta. This is only true if the map also didn't changed. So you can't
  71. recycle lmp's of e1m4. It is very interesting, that 1.5 lmp's, recorded
  72. even with the turbo option work with 1.2.
  73. </P>
  74. <H2>3. DATA</H2>
  75. <H3>3.1 Number of game tics</H3>
  76. <P>This formula for the number of game tics (NGT) follows from the
  77. first  section:
  78. </P>
  79. <PRE>                filelength-headerlength-1
  80.         NGT =   -------------------------
  81.                   4 * number of players
  82. </PRE>
  83. <P>The NGT stored in a lmp can also be found out with the -timedemo
  84. option.  At the replay end, doom shows the number of game tics and time
  85. tics. This game tic number corresponds with NGT only in newer versions
  86. of  DOOM (>=1.4). Older versions of DOOM report the wrong number
  87. (NGT+1). 
  88. </P>
  89. <P>With timedemo DOOM plays __all__ scenes in the lmp file back but
  90. without  any synchronizing. So you can calculate also the frames per
  91. second with:
  92. </P>
  93. <PRE>
  94.                            NGT
  95.                   fps = --------- * 35
  96.                         time tics
  97. </PRE>
  98. <P>This has nothing to do with your frame rate during the game.  This
  99. frame rate can be computed with the formula (from the FAQ v5.8 (9-2-1),
  100. thanks to Hank Leukart (ap641@cleveland.freenet.edu)) 
  101. </P>
  102. <PRE>                           70
  103.                   fps = --------
  104.                         dots + 1
  105. </PRE>
  106. <P>The dots are displayed with the -devparm option in the lower left
  107. edge of the screen. There are only 35 screens per second (each game
  108. tic), so one dot is always displayed. With every additional dot, DOOM
  109. shows how many vertical sync impulses (1/70s) were necessary to compute
  110. a whole screen.  The game is not slower but you don't see each screen:
  111. the game becomes jerky.
  112. </P>
  113. <H3>3.2 Multiplayer lmp</H3>
  114. <P>In a 2, 3 or 4 player game the game tics are alternated stored, ie
  115. for a  2 player game:</P>
  116. <PRE>game tic 1 of player 0
  117. game tic 1 of player 1
  118. game tic 2 of player 0
  119. game tic 2 of player 1
  120. game tic 3 of player 0
  121. game tic 3 of player 1
  122.            .
  123.            .
  124.            .
  125. </PRE>
  126. <H3>3.3 The -turbo parameter</H3>
  127. <P>This parameter speeds up all moves (forward, backward, strafe
  128. sideways) but not the turn. Due to the value sets described in section
  129. 3.4 all move bytes can be multiplied by 2.55 (or 255%) until they dont
  130. fit in a short int.  This is exactly what happens.  All normal move
  131. bytes are multiplied by the turbo value in percent. So you can play with
  132. -turbo 200 a normal game but your speed is the same as the shift key is
  133. always pressed. If you now press the shift key you are running like
  134. hell.</P>
  135. <P>The turbo parameter isn't stored in the lmp but DOOM shows in the
  136. message  line, if a player plays with turbo (ie "green is turbo"). DOOM
  137. conclude this from very large move bytes.
  138. </P>
  139. <H3>3.4 Data description</H3>
  140. <P>One game tic (for one player) corresponds to 4 bytes:
  141. </P>
  142. <PRE>  |    0    |    1    |    2    |    3    |
  143.   |   go    | strafe  |  turn   |   use   |
  144. </PRE>
  145. <H4>3.4.1. Byte 00h: Go Forward and Backward</H4>
  146. <P>The go byte contains a signed number (-127 (81h).. 127 (7Fh)), where
  147.  positive numbers describe a forward and negative numbers a backward
  148. move.  In older DOOM versions (and now with -turbo 100) the values go
  149. from -50 (CEh)... 50 (32h).</P>
  150. <P>With a mouse you can achive all these codes. The codes for
  151. keyboard/joystick actions are:</P>
  152. <PRE>-25 (E7h) / +25 (19h) go backward/forward
  153. -50 (CEh) / +50 (32h) go backward/forward with speed on
  154. </PRE>
  155. <H4>3.4.2 Byte 01h: Strafe Sideways</H4>
  156. <P>The strafe byte contains a signed number (-127 (81h).. 127 (7Fh)),
  157. where  positive numbers describe a right and negative numbers a left
  158. move.  In older DOOM versions (and now with -turbo 100) the values go
  159. from -50 (CEh)... 50 (32h).</P>
  160. <P>With a mouse you can achive all these codes. The codes for
  161. keyboard/joystick actions are:</P>
  162. <PRE>-24 (E8h) / +24 (18h) strafe left/right
  163. -50 (CEh) / +50 (32h) strafe left/right with speed on
  164.  
  165. </PRE>
  166. <H4>3.4.3 Byte 02h: Turn</H4>
  167. <P>The turn byte contains a signed number (-127 (81h).. 127 (7Fh)),
  168. where  positive numbers describe a left and negative numbers a right
  169. turn.  The values go from -127 (81h)... 127 (7Fh). In my lmp's the
  170. maximal values  are Turn Left 76 (4Ch) and Turn Right 78 (B2h). With a
  171. mouse you can achive all these codes.
  172. </P>
  173. <PRE>                  360
  174. The turn angle is --- * turn_byte degree.
  175.                   256   
  176. </PRE>
  177. <P>With IDMYPOS you can check your current viewing direction. During
  178. recording DOOM uses only a byte out of a long for the viewing angle:
  179. </P>
  180. <PRE>        (40h)
  181.           N
  182.  
  183. (80h) W   +   E (00h)
  184.        
  185.           S 
  186.         (C0h)
  187. </PRE>
  188. <P>The turn byte is directly the increment of the viewing angle.
  189. </P>
  190. <P>The codes for keyboard/joystick actions (in DOOM version <1.4)
  191. are:
  192. </P>
  193. <PRE> -2 (FEh) /  +1 (01h) start turn right/left
  194.  -3 (EDh) /  +2 (02h) turn right/left
  195.  -5 (FBh) /  +5 (05h) turn right/left with speed on
  196. </PRE>
  197. <P>Very strange is the fact, that the keyboard controlled right turn is
  198. faster  than the keyboard controlled left turn. This must be a bug.
  199. </P>
  200. <P>The codes for keyboard/joystick actions (in DOOM version >=1.4)
  201. are:
  202. </P>
  203. <PRE> -1 (FEh) /  +1 (01h) start turn right/left
  204.  -2 (EDh) /  +3 (02h) turn right/left
  205.  -5 (FBh) /  +5 (05h) turn right/left with speed on
  206. </PRE>
  207. <P>Now some people at id corrected the right turn but now is the left
  208. turn a bit faster.
  209. </P>
  210. <H4>3.4.4 Byte 03h: Use</H4>
  211. <P>In the use byte are coded the fire weapon, the press button/open
  212. door and the change weapon actions:</P>
  213. <PRE>   --------------------------------------------
  214.    | 7     | 6  | 5  | 4  | 3  | 2  | 1  | 0  |
  215.    | SA=0  | 0  |    Weapon    | WB | UB | FB |
  216.    --------------------------------------------
  217. </PRE>
  218. <P>The Fire Bit (FB) is 1 during a shot. The Use Bit (UB) indicates the
  219. use  of anything (press a button, open a door etc.). The Weapon Bit (WB)
  220. is 1 if  the player changes manually his weapon. The weapon number is
  221. stored in the  following bits.
  222. </P>
  223. <P>The weapon numbers are beginning with 0; not with 1 as is the status
  224. bar:
  225. </P>
  226. <PRE>       Code := 4 + 8* (Weapon-1)
  227. </PRE>
  228. <P>The codes are:
  229. </P>
  230. <PRE>   4 (04h) Activate Weapon 1 (Fist)
  231.   12 (0Ch) Activate Weapon 2 (Pistol)
  232.   20 (14h) Activate Weapon 3 (Shotgun)
  233.   28 (1Ch) Activate Weapon 4 (Chaingun)
  234.   36 (24h) Activate Weapon 5 (Rocket Launcher)
  235.   44 (2Ch) Activate Weapon 6 (Plasma Rifle)
  236.   52 (34h) Activate Weapon 7 (BFG 9000)
  237.   60 (3Ch) Activate Weapon 8 (Chainsaw)
  238. </PRE>
  239. <P>The bits can be composed. So you can with a use byte of 03h fire and
  240. use at the same time.
  241. </P>
  242. <P>If the Special Actions (SA) bit is 1, the meaning of the other bits
  243. changes totally:
  244. </P>
  245. <P>In the bits 0 and 1 is now coded the Special Action itself.
  246. </P>
  247. <PRE>-----------------
  248. |1|x|x|x|x|x|0|1|       stands for pause/unpause
  249. -----------------
  250.  
  251. </PRE>
  252. <P>and</P>
  253. <PRE>-----------------
  254. |1|x|x| SLN |1|0|       stands for save game in slot SLN (0<=SLN<=7).
  255. ----------------- 
  256. </PRE>
  257. <P>The x-bits aren't important at all. DOOM itselft let they 0 but does
  258. not analyze them afterwards. 
  259. </P>
  260. <P>DOOM saves the game even during the replay of a lmp.
  261. </P>
  262. <H4>3.4.5. Special entries</H4>
  263. <P>If there are no actions at all, all 4 bytes contain 00h. This is a
  264. wait tic. The end of the lmp is coded in the go byte of an uncomplete
  265. game tic. Because there is no go value of -128 (80h), DOOM can't make a
  266. mistake.
  267. </P></BODY></HTML>
  268. +-----------------------------------------------------------+
  269. |Bertrand Le Roy      |A Darwinian theory of Gravitation:   |
  270. |bleroy@ccr.jussieu.fr|In the beginning,  mature apples fell|
  271. |tel. 44.27.72.95     |in all directions. But only the trees|
  272. |fax. 44.27.72.87     |whose apples fell down have survived.|
  273. +-----------------------------------------------------------+
  274. |Laboratoire de Gravitation et Cosmologie Relativistes      |
  275. |Universite Pierre et Marie Curie, tour 22-12, 4e etage     |
  276. |4, place Jussieu, 75252 Paris Cedex 05                     |
  277. +-----------------------------------------------------------+
  278.  
  279.